package com.lw.sbdemo2.mapper;

import com.lw.sbdemo2.common.base.BaseMapper;
import com.lw.sbdemo2.entity.TkExamProductDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>标题: 试卷商品细表服务 - 数据交互层</p>
 * <p>描述: </p>
 * <p>版权: Copyright (c) 2019</p>
 * <p>公司: 山人行工作室</p>
 *
 * @version: 1.0
 * @author: LinWang
 * @date 2019-4-14
 */
@Mapper
public interface TkExamProductDetailMapper extends BaseMapper<TkExamProductDetail> {

    /**
     * 分页获取试卷商品细表列表
     *
     * @param query               搜索关键词
     * @param tkExamProductDetail 查询实体
     * @return 用户列表
     */
    List<TkExamProductDetail> findListPage(@Param("query") String query, @Param("model") TkExamProductDetail tkExamProductDetail);

    /**
     * 批量插入订单记录细表列表
     *
     * @param sysList
     * @return
     */
    void insertDetailBatch(@Param("sysList") List<TkExamProductDetail> sysList);

    /**
     * 批量查询细表列表
     *
     * @param sysList
     * @return
     */
    List<TkExamProductDetail> selectDetail(@Param("sysList") List<String> sysList);

    /**
     * 高频错题
     *
     * @param sysList
     * @return
     */
    List<TkExamProductDetail> findListGao(TkExamProductDetail t);

    /**
     * 获取班级人数
     *
     * @param teacherId
     * @return
     */
    @Select("SELECT COUNT(1) FROM tk_user_info t,tk_user_answer_exam_record b WHERE t.USER_ID = b.USER_ID and t.TEACHER_ID = #{teacherId} and b.EXAM_ID = #{examId}  ")
    Integer getClassNum(@Param("teacherId") String teacherId, @Param("examId") String examId);
}
